<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../js/vue.js"></script>
  <style>
    .active {
      color: red;
    }
  </style>
</head>

<body>
  <div id ="app">
    <!-- <h2 class="active">{{message}}</h2> -->
    <!-- <h2 :class="active">{{message}}</h2> -->

    <!-- <h2 v-bind:class="{key1:value1,key2:value2}">{{message}</h2> -->
    <!-- <h2 v-bind:class="{类名1:boolean,类名2:boolean}">{{message}</h2> -->

    <h2 v-bind:class="{active:isActive,line:isLIne}" class="base">{{message}}</h2>
    <h2 v-bind:class="getClasses()" class="base">{{message}}</h2>
    <button @click=handleClick>按钮</button>

  </div>

  <script>
   var vm = new Vue({
    el: '#app',
    data: {
      message:'hello',
      // active:'active'
      isActive:true,
      isLIne:true
    },
    methods: {
      handleClick:function(){
        this.isActive = !this.isActive
      },
      getClasses:function(){
        return {
          active:this.isActive,
          line:this.isLIne
        }
      }
    }
   });
  </script>
</body>

</html>